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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

c = A("c")
f = B("f")
i = C("i")
m = D("m")
g = E("g")
j = F("j")

c.u = m
c.o = m
c.w = f
c.t = g
c.y = g
f.q = g
f.y = c
i.o = f
i.y = c
m.z = j
g.u = i
g.o = i
g.r = f
j.x = i
assert f.y.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: B = None
        self.t: E = None
        self.y: E = None
        self.o: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

c = A("c")
f = B("f")
i = C("i")
m = D("m")
g = E("g")
j = F("j")

c.u = m
c.o = m
c.w = f
c.t = g
c.y = g
f.q = g
f.y = c
i.o = f
i.y = c
m.z = j
g.u = i
g.o = i
g.r = f
j.x = i
assert f.y.u.z.txt == "j"