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

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: A = None
        self.v: F = None
        self.p: C = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

i = A("i")
b = B("b")
g = C("g")
m = D("m")
h = E("h")
c = F("c")
n = E("n")
j = D("j")

i.u = g
b.u = n
b.y = m
b.x = h
b.p = h
b.t = i
g.z = b
m.q = g
m.p = g
m.y = i
m.v = c
m.r = h
h.y = g
c.p = i
c.u = i
c.y = h
c.r = b
c.o = g
n.y = g
j.q = g
j.p = g
j.y = i
j.v = c
j.r = n
assert i.u.z.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: A = None
        self.v: F = None
        self.p: C = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

i = A("i")
b = B("b")
g = C("g")
m = D("m")
h = E("h")
c = F("c")
n = E("n")
j = D("j")

i.u = g
b.u = n
b.y = m
b.x = h
b.p = h
b.t = i
g.z = b
m.q = g
m.p = g
m.y = i
m.v = c
m.r = h
h.y = g
c.p = i
c.u = i
c.y = h
c.r = b
c.o = g
n.y = g
j.q = g
j.p = g
j.y = i
j.v = c
j.r = n
assert i.u.z.t.u.txt == "g"