class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: D = None
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.s: C = None
        self.p: F = None
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: A = None
        self.o: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: C = None
        self.t: A = None
        self.u: E = None
        self.txt = txt

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

f.y = c
f.u = h
f.r = l
g.q = l
g.p = l
g.s = c
g.z = d
c.u = g
c.o = g
c.y = f
k.w = c
j.z = h
l.y = k
l.o = c
l.t = f
l.u = j
d.y = k
d.o = c
d.t = f
d.u = m
m.z = k
h.w = c
assert f.r.t.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: D = None
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.s: C = None
        self.p: F = None
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: A = None
        self.o: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: C = None
        self.t: A = None
        self.u: E = None
        self.txt = txt

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

f.y = c
f.u = h
f.r = l
g.q = l
g.p = l
g.s = c
g.z = d
c.u = g
c.o = g
c.y = f
k.w = c
j.z = h
l.y = k
l.o = c
l.t = f
l.u = j
d.y = k
d.o = c
d.t = f
d.u = m
m.z = k
h.w = c
assert f.r.t.r.u.txt == "j"