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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: A = None
        self.v: A = None
        self.p: C = None
        self.t: A = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: A = None
        self.v: A = None
        self.p: C = None
        self.t: A = None
        self.txt = txt

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

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

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

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