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

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.o: F = None
        self.x: F = None
        self.r: B = None
        self.q: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.o: F = None
        self.x: F = None
        self.r: B = None
        self.q: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: B = None
        self.txt = txt

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

d.x = n
d.y = f
i.q = d
i.v = n
i.w = g
i.z = a
g.p = f
g.o = n
g.x = n
g.q = n
g.r = i
c.w = d
c.o = d
c.u = d
c.v = g
c.y = j
c.s = f
f.r = n
n.u = f
n.p = i
a.x = n
a.y = f
j.p = f
j.o = n
j.x = n
j.q = n
j.r = i
b.q = a
b.z = a
b.v = n
b.w = j
assert j.p.r.u.r.u.r.u.txt == "f"