class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: F = None
        self.v: E = None
        self.y: E = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: E = None
        self.p: A = None
        self.s: E = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: A = None
        self.y: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: F = None
        self.o: B = None
        self.w: B = None
        self.z: B = None
        self.v: B = None
        self.q: A = None
        self.txt = txt

c = A("c")
g = B("g")
f = C("f")
d = D("d")
l = E("l")
h = F("h")
b = A("b")
n = D("n")
j = F("j")

c.o = b
g.r = f
g.t = j
g.v = l
g.y = l
g.z = c
f.x = d
f.v = l
f.s = l
f.p = b
f.t = b
d.w = c
d.v = b
l.x = g
l.y = g
l.v = b
h.y = j
h.o = g
h.w = g
h.z = g
h.v = g
h.q = c
b.o = c
n.w = b
n.v = b
j.y = h
j.o = g
j.w = g
j.z = g
j.v = g
j.q = c
assert d.w.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: F = None
        self.v: E = None
        self.y: E = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: E = None
        self.p: A = None
        self.s: E = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: A = None
        self.y: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: F = None
        self.o: B = None
        self.w: B = None
        self.z: B = None
        self.v: B = None
        self.q: A = None
        self.txt = txt

c = A("c")
g = B("g")
f = C("f")
d = D("d")
l = E("l")
h = F("h")
b = A("b")
n = D("n")
j = F("j")

c.o = b
g.r = f
g.t = j
g.v = l
g.y = l
g.z = c
f.x = d
f.v = l
f.s = l
f.p = b
f.t = b
d.w = c
d.v = b
l.x = g
l.y = g
l.v = b
h.y = j
h.o = g
h.w = g
h.z = g
h.v = g
h.q = c
b.o = c
n.w = b
n.v = b
j.y = h
j.o = g
j.w = g
j.z = g
j.v = g
j.q = c
assert d.w.o.o.o.o.o.o.o.txt == "b"